package cn.itcast.nems.studentrecord.dao.condition;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
public enum ReceivableAdjustmentState {
    DRAFT("草稿"),
    PENDING("待审批"),
    APPROVING("审批中"),
    REJECTED("审批未通过"),
    CANCELED("已撤回"),
    FINISHED("全部审批通过审批完成"),

    ;

    private final String desc;

    /**
     * 判断当前凭单是否可以编辑
     *
     * @param state 凭单状态
     * @return boolean 是否可以编辑
     * @author 高昌露
     * @since 2023/11/23 14:49
     */
    public static boolean canEdit(ReceivableAdjustmentState state) {
        return DRAFT.equals(state);
    }


    /**
     * 判断当前凭单是否可以撤销
     *
     * @param state 凭单状态
     * @return boolean 是否可以撤销
     * @author 高昌露
     * @since 2023/11/23 14:49
     */
    public static boolean canCancel(ReceivableAdjustmentState state) {
        return PENDING.equals(state) || DRAFT.equals(state);
    }

    /**
     * 判断当前凭单是否可以审批
     *
     * @param state 凭单状态
     * @return boolean 是否可以审批
     * @author 高昌露
     * @since 2023/11/23 14:49
     */
    public static boolean canApprove(ReceivableAdjustmentState state) {
        return PENDING.equals(state) || APPROVING.equals(state);
    }
}
